/*
 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

/**
 * <p>Project: javase - Str1
 * <p>Powered by webrx On 2021-12-02 14:12:29
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Str1 {
    public static void main(String[] args) {
        //01 java String 不可改变
        //02 转义符 \
        //
        var s1 = "\"HELLO\" \n '中\b'\t文\\";
        String s2 = "字符串string";
        String s3 = "java程序设计";
        //System.out.println(s1);
        s1 = "abc";
        //System.out.println(s1);


        //03 java 15 字符串块 """
        var code = """
                /*
                 * Copyright (c) 2006, 2021, webrx.cn All rights reserved.
                 *
                 */
                package cn.webrx;

                /**
                 * <p>Project: javase - Str1
                 * <p>Powered by webrx On 2021-12-02 14:12:29
                                
                 *
                 * @author webrx [webrx@126.com]
                 * @version 1.0
                 * @since 17
                 */
                public class Str1 {
                    public static void main(String[] args) {
                        //01 java String 不可改变
                        //02 转义符 \\
                        //
                        var s1 = "\\"HELLO\\" \\n '中\\b'\\t文\\\\";
                        String s2 = "字符串string";
                        String s3 = "java程序设计";
                        System.out.println(s1);
                        s1 = "abc";
                        System.out.println(s1);

                    }
                }
                                
                """;

        //System.out.println(code);

        System.out.println(code.lines().count());

        System.out.println("*".repeat(6));

        //4 获取字符串字符个数，字节个数
        System.out.printf("%s:有%d个字符，有%d个字节%n", s3, s3.length(), s3.getBytes().length);


    }
}
